function t(t, a, i) {
    return a in t ? Object.defineProperty(t, a, {
        value: i,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : t[a] = i, t;
}

var a, i = require("../export.js");

getApp(), require("../../../wxParse/wxParse.js");

Page((a = {
    data: {
        CarList: [],
        index: -1,
        Explain: [],
        coupon: [],
        index1: -1,
        options: {},
        CarLevelList: []
    },
    onLoad: function(t) {
        this.setData({
            options: t
        }), this.getCarList(t), this.getExplain(t);
    },
    onReady: function() {},
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    formSubmit: function(t) {
        console.log(t);
    },
    getCarList: function(t) {
        var a = this;
        i.requestUtil.post(i._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Api/getCarList.html", t, function(i) {
            if (a.setData({
                CarList: i
            }), t.car_goods_id) for (var n = 0; n < a.data.CarList.length; n++) t.car_goods_id == a.data.CarList[n].id && a.setData({
                index: n
            });
        }), i.requestUtil.post(i._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Api/getCarLevelList.html", t, function(i) {
            if (a.setData({
                CarLevelList: i
            }), t.car_goods_level_id) for (var n = 0; n < a.data.CarLevelList.length; n++) t.car_goods_level_id == a.data.CarLevelList[n].id && a.setData({
                index1: n
            });
        });
    },
    bindPickerChange: function(t) {
        var a = this, n = t.detail.value;
        this.setData({
            index: n
        });
        var e = this.data.CarList[n].id, o = this.data.options;
        o.car_goods_id = e, i.requestUtil.post(i._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Api/getCarLevelList.html", o, function(t) {
            a.setData({
                CarLevelList: t
            });
        });
    },
    bindPickerChange1: function(t) {
        var a = t.detail.value;
        this.setData({
            index1: a
        });
    }
}, t(a, "formSubmit", function(t) {
    var a = this, n = t.detail.value;
    if (-1 != n.car_goods_id) if (-1 != n.car_goods_level_id) {
        n.car_goods_id = this.data.CarList[this.data.index].id, n.car_goods_level_id = this.data.CarLevelList[this.data.index1].id;
        var e = n;
        console.log(this.data), this.setData({
            submitIsLoading: !0,
            buttonIsDisabled: !0
        }), i.requestUtil.post(i._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Apiform/xunjia.html", e, function(t) {
            console.log(t), a.xunjia(t);
        }, this, {
            isShowLoading: !1,
            completeAfter: function(t) {
                this.setData({
                    submitIsLoading: !1,
                    buttonIsDisabled: !1
                });
            }
        });
    } else i.dg.alert("请选择车型"); else i.dg.alert("请选择车款");
}), t(a, "xunjia", function(t) {
    this.setData({
        submitIsLoading: !1,
        buttonIsDisabled: !1
    }), wx.showModal({
        title: "提示",
        content: t.info,
        showCancel: !1,
        complete: function(t) {
            wx.navigateTo({
                url: "/pages/car/index/index",
                fail: function(t) {
                    wx.switchTab({
                        url: "/pages/car/index/index"
                    });
                }
            });
        }
    });
}), t(a, "getExplain", function(t) {
    var a = this;
    i.requestUtil.post(i._DuoguanData.duoguan_host_api_url + "/index.php/addon/DuoguanCar/Api/getExplain.html", t, function(t) {
        a.setData({
            Explain: t.explain,
            coupon: t.coupon,
            Exlength: t.explain.xunjia_explain.length
        });
    });
}), t(a, "goCoupon", function() {
    wx.navigateTo({
        url: "/pages/car/get-coupon/get-coupon"
    });
}), a));